﻿<!DOCTYPE html>
<!--承包商入场工具管理列表-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <style>
        .el-table__body-wrapper table tbody tr td {
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW50">
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
            style="margin-bottom: 15px;">

            <el-row>
                <el-col class="head-tool">
                    
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />承包商入场工具管理列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>
                        <btn-uploadfile-list url="/api/CBS_IntoFactoryTool/Import" linetype="3"></btn-uploadfile-list>
                        <btn-export-list url="/api/CBS_IntoFactoryTool/Export" :forminline="this.formInline" linetype="3">
                        </btn-export-list>
                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input  size="mini">
                                <template slot="prepend">
                                    {{ContractorAdmissionTool.ContractorName+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.CBSListId" slot="suffix"
                                            :placeholder="ContractorAdmissionTool.ContractorName">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in CBS_Lists" :label="item.contractorName"
                                               :value="item.id"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>

        <el-table stripe ref="table" :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight"
            border @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
            <el-table-column type="selection" style=" padding-top: 0px;  padding-bottom: 0px;" align="center"
                width="55" >
            </el-table-column>
            <el-table-column type="index" :label="ContractorDirectory.SerialNumber" :index="indexMethod" width="50"
                show-overflow-tooltip="true"></el-table-column>
            <el-table-column prop="mark01" :label="ContractorAdmissionTool.ContractorName" min-width="180"
                             show-overflow-tooltip="true">
                <template slot-scope="scope">
                    <el-button type="text" @click="columnLabel_click('wc',scope.row.id)">
                        {{scope.row.mark01}}
                    </el-button>
                </template>
               
            </el-table-column>
            <el-table-column prop="headUser" :label="ContractorAdmissionTool.PersonnelName" min-width="95"
                show-overflow-tooltip="true">
            </el-table-column>

            <el-table-column prop="phone" :label="ContractorAdmissionTool.phone" min-width="115"
                show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="carryingToolName" :label="ContractorAdmissionTool.CarryingToolName" min-width="115"
                show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="toolChecker" :label="ContractorAdmissionTool.ToolInspector" min-width="150"
                show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="carryingToolQuantity" :label="ContractorAdmissionTool.InCarryingQuantity"
                show-overflow-tooltip="true" min-width="120">
            </el-table-column>
            <!-- <el-table-column prop="CarryingToolQuantity" :label="ContractorAdmissionTool.CarryingToolQuantity"
                min-width="140" show-overflow-tooltip="true">
            </el-table-column> -->

            <!-- <el-table-column prop="IsConsumables" :label="ContractorAdmissionTool.IsConsumables" min-width="150px"
                show-overflow-tooltip="true">
            </el-table-column> -->
            <el-table-column prop="arrivalTime" :label="ContractorAdmissionTool.ArrivalTime" :formatter="dateFormat" min-width="185"
                show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column prop="mark02" :label="ContractorAdmissionTool.OutCarryingQuantityEd" min-width="120"
                show-overflow-tooltip="true">
            </el-table-column>
            <!-- <el-table-column prop="SituationStatement" :label="ContractorAdmissionTool.SituationStatement"
                show-overflow-tooltip="true" min-width="260">
            </el-table-column> -->

            <!-- <el-table-column prop="DepartureTime" :label="ContractorAdmissionTool.DepartureTime" min-width="185"
                show-overflow-tooltip="true">
            </el-table-column> -->
            <!--<el-table-column prop="status"
                             :label="ContractorAdmissionTool.status" width="50" >
            </el-table-column>-->
            <el-table-column width="53" prop="update" :label="col.btnPinCore" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=PinCore('xg',scope.row.id)>
                        <i class="el-icon-edit"></i>
                    </button>
                </template>
            </el-table-column>
        </el-table>
        <el-row type="flex" justify="end">
            <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                :layout="ListItem.layout" :total="ListItem.total">
            </el-pagination>
        </el-row>
        <el-dialog title="承包商入场工具管理" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog'
            width="80%" height="80%" top="10vh" fullscreen="true">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    CBS_Lists: [],
                    ConstructionCategory: [],
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            CBSListId: '',
                            PersonnelName: '',//姓名
                            CarryingToolName: '',//携带工具名称
                            CarryingToolQuantity: '',//入场携带工具数量
                            phone: '',//电话号
                            IsConsumables: '',//是否为消耗品
                            ContractorName: '',//承包商名称
                            ArrivalTime: '', //进场时间
                            SituationStatement: '',//情况说明
                            InCarryingQuantity: '',//出场携带工具数量
                            DepartureTime: '',//离场时间
                            status: ''
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            }, created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                //获取下拉菜单内容
                this.getCBS_List();
                //this.ConstructionCategory = getDicData('25');
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },

                handleNodeClick: function (data) {
                    console.log(data);
                },
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/CBS_IntoFactoryTool/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) {
                    DialogShow(this, val, "ContractorAdmissionToolManagementInput.html", id);
                },

                PinCore: function (val, id) { DialogShow(this, val, "ContractorAdmissionToolManagementPinCore.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/CBS_IntoFactoryTool/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); }
                //初始化承包商下拉框
                ,getCBS_List: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/CBS_List/GetList', { model: { status: '', CreateFactory: null }, offset: 0, limit: 100 }, function (response) {
                        mythis.CBS_Lists = response.data.pageData;
                        console.log('h1', response.data.pageData);
                    }, false);
                },
                //点击表格中数据发生方法
                columnLabel_click: function (val, id) { DialogShow(this, val, "ContractorAdmissionToolPinCorehistory.html", id); },
            }
        });
        function dateFormat(row, column, cellValue, index){
            const daterc = row[column.property]
            return daterc.toString().substring(0,16);
            //if (daterc != null) {
            //    const date = new Date(parseInt(daterc.replace("/Date(", "").replace(")/", ""), 10));

            //    let Y = date.getFullYear() + '-';
            //    let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
            //    let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
            //    let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
            //    let m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
            //    let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();

            //    return Y + M + D+h+m;
            //}

        }
    </script>
</body>

</html>